
/**
	单一系统用户树	
**/
function singleuserinfocheckedtree(dataBaseId){
		Ext.apply(Ext,{
			systemTitle:'天津利达粮油有限公司',
			basePath:'http://'+window.location.host+'/RQOAtree/'
		});
	  	var userid="",usernametext="";
		var tree;
		var root;
	 	var Tree = Ext.tree;
	//    var url = Ext.basePath+"tjsinfo/rqoatree/system/selectSystemDepartment.action";
	 	var url = Ext.get('basePath').getValue()+"tjsinfo/tjsoa/system/selectUserTree.do?method=getusercheck";
	 	var load = new Ext.tree.TreeLoader({
		 	dataUrl:url,
		 	baseParams:{"dataBaseId":dataBaseId}
		});
		root = new Tree.AsyncTreeNode({
			text:Ext.systemTitle,
			id:0,
			draggable:false
		});
	    tree = new Ext.tree.TreePanel({
			autoScroll:true, 
			containerScroll:true,
			height: 400,     
		    loader:load,
		    border:true,
		    x:0,
		    y:0,
		    anchor:"100% 100%",
		    root: root
	    });
	    
		tree.on("checkchange",function(node,checked){
		    node.expand();
		    node.attributes.checked = checked;
		    node.eachChild(function(child){		    
		    	child.ui.toggleCheck(checked);
		    	child.attributes.checked = checked;
		    	child.fireEvent("checkchange",child,checked);			
			});
		    	
		});
	     
	   
	   var win = new Ext.Window({
			layout:"absolute",
			title:'人员选择',
			width:400,
			height:400,
			modal:true,
			items:[tree],
			buttonAlign:'center',
			buttons:[{
				text:"确定",
				handler:function(){
					for(var i = 0;i<tree.getChecked().length;i++){
						if(tree.getChecked()[i].attributes.isdepartment != true){
							usernametext += tree.getChecked()[i].text;
							usernametext += ",";
							userid += tree.getChecked()[i].id;
							userid += ",";
						}						
					}
					if(usernametext.length > 1){
						usernametext = usernametext.substring(0,usernametext.length - 1 );
						userid = userid.substring(0,userid.length - 1 );
					}					
					win.fireEvent("winsubmint",{"usernametext":usernametext,"userid":userid});
				}
			}]
		});
		
		win.addEvents("winsubmint");
		win.on("show",function(){
			tree.expand(true,true);
		});	
	    return win;
	}	